#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

struct treeStruct
{
  char treeChar;
  struct treeStruct *leftTreeNode;
  struct treeStruct *rightTreeNode;
};

//return fwrite
int WriteFile(FILE *fp, char *content)
{
  return fwrite(content,sizeof(char),strlen(content),fp);
}

void ErrorLog(char *content)
{
  FILE *errorLogFile;
  if((errorLogFile = fopen("error.log","a")) == NULL)
    {
      printf("log error");
      printf("\n");
    }
  WriteFile(errorLogFile,content);
}


FILE *FileOpenReadOnly(char *path)
{
  FILE *fp;
  if((fp = fopen(path,"r")) == NULL)
    {
      strcat(path," is fail to open\n");
      ErrorLog(path);
      exit(1);
    }
  return fp;
}

int main(int argc,char **argv)
{
  FILE *fp;
  fp = FileOpenReadOnly("tree1.txt");
  
  return 0;
}
